#include "CEntity.h"


CEntity::CEntity()
{
	Init(NULL);
}

CEntity::CEntity(ENTITY_PARAMS* params){
	Init(params);
}

CEntity::~CEntity()
{
	SAFE_DELETE( m_pCollider );
}



void CEntity::Init(ENTITY_PARAMS* params)
{
	m_pCollider = NULL;

	if(params){
		m_pos=params->pos;
		m_accel=params->accel;
		m_width=params->width;
		m_height=params->height;
		m_halfwidth=(int)(m_width/2);
		m_halfheight=(int)(m_height/2);
		m_depth=params->depth;
		m_state=params->stateflags;
	}else{
		m_pos=V0;
		m_accel=V0;
		m_width=0;
		m_height=0;
		m_halfwidth=0;
		m_halfheight=0;
		m_depth=0;
		m_state=0;
	}

	// FIXME: not all entities need this
	m_pCollider = new CCollider_AABB(this);

	m_scale=V(1, 1);
	m_angle=0;
	m_objectid=0;
	m_dir=1;
	m_hp=100;
}